package model.contrainte;

import java.util.List;


public class ContrainteCompetence implements Contrainte{

	private List<TypeCompetence> listeTypeCompetence;
	
	public ContrainteCompetence(List<TypeCompetence> listeTypeCompetence) {
		this.listeTypeCompetence = listeTypeCompetence;
	}
	public boolean isCompatible(Contrainte c) {
		
		for(TypeCompetence type1 :((ContrainteCompetence) c).listeTypeCompetence){
			for(TypeCompetence type2 : listeTypeCompetence){
				if(type2.equals(type1)) return true;
			}
		}		
		return false;
	}

	public TypeContrainte getTypeContrainte() {
		return TypeContrainte.COMPETENCE;
	}

	public boolean equals(Contrainte c) {
		if(c.getTypeContrainte()!=getTypeContrainte()) return false;
		for(TypeCompetence type1 :((ContrainteCompetence) c).listeTypeCompetence){
			for(TypeCompetence type2 : listeTypeCompetence){
				if(type2.equals(type1)) return false;
			}
		}		
		return true;
	}
	/**
	 * @param listeTypeCompetence the listeTypeCompetence to set
	 */
	public void setListeTypeCompetence(List<TypeCompetence> listeTypeCompetence) {
		this.listeTypeCompetence = listeTypeCompetence;
	}
	/**
	 * @return the listeTypeCompetence
	 */
	public List<TypeCompetence> getListeTypeCompetence() {
		return listeTypeCompetence;
	}

}
